package rohyunji;

import java.awt.CardLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.JLabel;




public class LoginSVC extends   JPanel {
	private 	String result="";
	MemberVO mv=null;
	MEMBERDAO mdao=null;
	
	private int i=0;
	
	public LoginSVC() {
		mv=new MemberVO();
		mdao=new MEMBERDAO();
	}
	
	
//  로그인 된후의  로그인영역 
	public LoginSVC(String id) 
	{
		
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[]{30, 1, 12, 0};
		gridBagLayout.rowHeights = new int[]{15, 0, 0, 0};
		gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
		gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
		setLayout(gridBagLayout);
		JLabel lblSs = new JLabel("id");
		GridBagConstraints gbc_lblSs = new GridBagConstraints();
		gbc_lblSs.anchor = GridBagConstraints.WEST;
		gbc_lblSs.insets = new Insets(0, 0, 5, 5);
		gbc_lblSs.gridx = 1;
		gbc_lblSs.gridy = 0;
		add(lblSs, gbc_lblSs);
		lblSs.setText(id);
		
		JLabel label = new JLabel("님 반갑습니다.");
		GridBagConstraints gbc_label = new GridBagConstraints();
		gbc_label.insets = new Insets(0, 0, 5, 5);
		gbc_label.anchor = GridBagConstraints.NORTHWEST;
		gbc_label.gridx = 2;
		gbc_label.gridy = 0;
		add(label, gbc_label);
		
		JLabel mstate_lbl = new JLabel("이력서또는공고:");
		GridBagConstraints gbc_mstate_lbl = new GridBagConstraints();
		gbc_mstate_lbl.insets = new Insets(0, 0, 5, 5);
		gbc_mstate_lbl.gridx = 1;
		gbc_mstate_lbl.gridy = 1;
		add(mstate_lbl, gbc_mstate_lbl);
		
		JLabel mstate2_lbl = new JLabel("미등록또는등록");
		GridBagConstraints gbc_mstate2_lbl = new GridBagConstraints();
		gbc_mstate2_lbl.insets = new Insets(0, 0, 5, 5);
		gbc_mstate2_lbl.gridx = 2;
		gbc_mstate2_lbl.gridy = 1;
		add(mstate2_lbl, gbc_mstate2_lbl);
		
	

			
		
	}

	
	
	//로그인 처리
	String Login(String id,String pw) 
	{
		
		 mv.setMb_id(id); mv.setMb_pw(pw);
	

		 if(mdao.countMember(mv)>0) 	result="로그인합니다.";
		 else result="아이디 또는 패스워드가 맞지 않습니다.";
		
		return result;
	}
	
	//메뉴 구성을 위한 회원유형 DB검색
	  String selectMb_type(String id)
      {
              String a="";
              for(MemberVO mv2:mdao.SelectMember(mv))
              {
                      a=mv2.getMb_type();
              }
              return a;
      }
	  
	  	  String selectMb_no(String id)
      {
          String a="";
          for(MemberVO mv2:mdao.SelectMember(mv))
          {
                  a=mv2.getMb_type();
          }
          return a;
  }

	



}
